package org.example;

import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;

public class ffff {
    public static void main(String[] args) {
        // 初始化 SparkSession
        SparkSession spark = SparkSession.builder()
                .appName("TopSalaries")
                .master("local[*]")
                .getOrCreate();

        Dataset<Row> df = spark.read().option("header", "true").csv("C:\\Users\\Administrator\\Desktop\\Employee_salary_first_half.csv");
        Dataset<Row> top3Salaries = df.orderBy(df.col("GROSS").desc()).limit(3);
        top3Salaries.show();
        spark.stop();
    }
}
